(function($, window) {
	var baseRequest = window.baseRequest;
	var appConfig = window.appConfig;
	var commonTool = window.commonTool;
	var dataManager = window.dataManager;
	var baseUrl = appConfig.oasisBaseUrl + '/stamonitor/monitor';
	//var baseUrl = appConfig.oasisBaseUrl + '/stamonitor/histclientstatistic_bycondition?';
	var newStaMonitor = window.newStaMonitor = {};

	//add by dongjuanying
	
	//endac

	//add by zhangfuqiang
	
	//end

	//add by ding
	
//	newStaMonitor.getAssociatedTerminal = function(devSN,nasId,dataType,callback){
//		baseRequest.commonGet(baseUrl + mui.param({
//              devSN: devSN,
//              nasId: nasId,
//              dataType: dataType
//          }),5000,function(code,data){
//          	if(code ===2 || code === 1){
//          		return callback(2);
//          	}
//          	if(code === 0){
//          		if (data == -1 || data.errcode) {
//	                    callback(1);
//	                } else {
//	                    callback(0, data.histclientList);
//	                }
//          	}
//          });
//	}
//	
//	newStaMonitor.getAuthenticationTerminal = function(devSN,nasId,dataType,auth,callback){
//		baseRequest.commonGet(baseUrl + mui.param({
//              devSN: devSN,
//              nasId: nasId,
//              dataType: dataType,
//              auth: auth
//          }),5000,function(code,data){
//          	if(code ===2 || code === 1){
//          		return callback(2);
//          	}
//          	if(code === 0){
//          		if (data == -1 || data.errcode) {
//	                    callback(1);
//	                } else {
//	                    callback(0, data.histclientList);
//	                }
//          	}
//          });
//	}
	
//dataType="auth" 获取认证用户总数   dataType=""获取关联终端总数
	newStaMonitor.getOnlineUserHistoryOfOneMonth = function(shopId,dataType,callback){
		baseRequest.commonPost(baseUrl, {
			method:"getclientcountbyscenarioid_onemonth",
			param:{
				scenarioid:shopId,
				dataType:dataType
			}
		},5000, function(code, data) {
			if(code === 2 || code === 1) {
				return callback(2);
			}
			if(code === 0) {
				if(data.errCode === 0){
					callback(0,data.response);
				}else{
					callback(1);
				}
			}
		});
	}
	newStaMonitor.getOnlineUserHistory = function(shopId,methodType,dataType,callback){
		baseRequest.commonPost(baseUrl, {
			method:methodType,
			param:{
				scenarioid:shopId,
				dataType:dataType
			}
		},5000, function(code, data) {
			if(code === 2 || code === 1) {
				return callback(2);
			}
			if(code === 0) {
				if(data.errCode === 0){
					callback(0,data.response);
				}else{
					callback(1);
				}
			}
		});
	}
	//newStaMonitor.getNewUserOfOneMonth = function(devSN,dataType,callback){
	//method:"clientstat_newvisitorcount",
	//param:{indexType:"devSN",index:devSN,dataType:dataType,dateType:"onemonth"}
	newStaMonitor.getNewUserOfOneMonth = function(shopId,dataType,callback){
		baseRequest.commonPost(baseUrl, {
			method:"getnewvisitorbyscenarioid_onemonth",
			param:{
				scenarioid:shopId,
				dataType:dataType
			}
		},5000, function(code, data) {
			if(code === 2 || code === 1) {
				return callback(2);
			}
			if(code === 0) {
				if(data.errCode === 0){
					callback(0,data.response);
				}else{
					callback(1);
				}
			}
		});
	}
	
	newStaMonitor.getNewUser = function(shopId,methodType,dataType,callback){
		baseRequest.commonPost(baseUrl, {
			method:methodType,
			param:{
				scenarioid:shopId,
				dataType:dataType
			}
		},5000, function(code, data) {
			if(code === 2 || code === 1) {
				return callback(2);
			}
			if(code === 0) {
				if(data.errCode === 0){
					callback(0,data.response);
				}else{
					callback(1);
				}
			}
		});
	}
	
	//end

	//add by wangyu

	//end

	//add by wuchengcheng

	//end

})(mui, window);